package com.faxsun.api.wrapper.inventory;


import javax.servlet.http.HttpServletRequest;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import org.broadleafcommerce.core.catalog.domain.Sku;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.faxsun.core.catalog.domain.FSSkuImpl;

@Component("fsInventoryWrapper")
@Scope("prototype")
@XmlRootElement(name = "fsInventory")
@XmlAccessorType(value = XmlAccessType.FIELD)
@XmlType(name="fsInventoryResource")
public class InventoryWrapper extends org.broadleafcommerce.core.web.api.wrapper.InventoryWrapper {
	@XmlElement
	protected Integer quantityTotal;
	
	public void wrapDetails(Sku sku, Integer quantityAvailable, HttpServletRequest request) {
		super.wrapDetails(sku, quantityAvailable, request);
		this.quantityTotal = ((FSSkuImpl)sku).getQuantityTotal();
	}
	
	public void wrapSummary(Sku sku, Integer quantity, HttpServletRequest request) {
        wrapDetails(sku, quantity, request);
    }

}
